<% layout('/layouts/default.html', {title: '考核任务指标表管理', libs: ['dataGrid','fileupload','validate']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div style="float: left">
				<div class="form-group">
					<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('返回')}</button>
				</div>
			</div>
			<#form:form id="searchForm" model="${dcSupExamQuotaInfo!}" action="${ctx}/quota/dcSupExamQuotaInfo/listKeyData?quotaId=${dcSupExamQuota.id}&quotaGroup=1" method="post" class="form-inline "
			data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize!100}" data-order-by="${parameter.orderBy}">
			<div style="float: right">
				<div class="form-group">

						<#form:hidden path="exameOrg"/>
				</div>
			</div>
		</#form:form>

	</div>
	<div class="box-body" >

		<div style="float: left;">
			<div class="form-group">
				<% if(dcSupExamQuota.quotaGroup == '1'){ %>
				<label class="blue " >${text('关键考核指标')}</label>
				<% } %>
				<% if(dcSupExamQuota.quotaGroup == '2'){ %>
				<label class="blue " >${text('单项考核指标')}</label>
				<% } %>
			</div>
		</div>
		<div style="float: right;">
<!--			<a href="#"  onclick="addQuotaInfo('${dcSupExamQuota.id}')" class="btn btn-primary btn-sm mr10 mb10" style="background-color:#00B7EE;border-color: #00b7ee;margin-left: 10px" title="${text("新增指标")}"> 新增指标</a>-->
<!--			<a href="#"  onclick="addKpi2()" class="btn btn-primary btn-sm mr10 mb10" style="background-color:#00B7EE;border-color: #00b7ee;margin-left: 10px" title="${text("引入上一年指标")}"> 引入上一年指标</a>-->
<!--			<a href="#"  onclick="addKpi3()" class="btn btn-primary btn-sm mr10 mb10" style="background-color:#00B7EE;border-color: #00b7ee;margin-left: 10px" title="${text("导入")}">导入</a>-->
		</div>
	</div>
	<#form:form id="inputForm" model="${dcSupExamQuota}" action="${ctx}/quota/dcSupExamQuota/save" method="post" class="form-horizontal">
	<div class="box-body">

		<table id="dataGrid"></table>
	</div>
	<p style="height: 10px"></p>
	<div class="row">
	<div class="col-xs-6">
		<div class="form-group">
			<label class="control-label col-sm-4" title="">
				<span class="required hide">*</span> ${text('联系人&nbsp;&nbsp;')}：<i class="fa icon-question hide"></i></label>
			<div class="col-sm-8">
				<#form:hidden path="id" />
				<#form:input path="contactName" class="form-control" readonly="true"/>
			</div>
		</div>
	</div>
	
		<div class="col-xs-6">
			<div class="form-group">
				<label class="control-label col-sm-4" title="">
					<span class="required hide">*</span> ${text('联系电话')}：<i class="fa icon-question hide"></i></label>
				<div class="col-sm-8">
					<#form:input path="contactPhone" class="form-control" readonly="true"/>
					<#form:hidden path="dcSupExamQuotaInfoList" class="form-control"/>
				</div>
			</div>
		</div>
	</div>
		<p></p>
	<div class="row">
		<div class="col-xs-12">
			<div class="form-group">
				<span class="control-label col-sm-2">
					<span class="required hide">*</span>附件上传：</span>
				<div class="col-sm-10">
					<#form:fileupload id="uploadFile" bizKey="${dcSupExamQuota.id}" bizType="dcSupExamQuota_file"
					uploadType="all" class="" readonly="true" preview="true" maxUploadNum="3"/>
				</div>
			</div>
		</div>
	</div>
</div>

</div>
</#form:form>
<% } %>
<script src="${ctxStatic}/m/js/total.js?${_version}"></script>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("考核年度2")}', name:'examYear',hidden:true },
		{header:'${text("指标类别")}', name:'quotaType', index:'a.quota_type', width:150, align:"left"
			, formatter: function(val, obj, row, act){
				return js.getDictLabel(${@DictUtils.getDictListJson('dc_quotaType')}, val, '${text("未知")}', true);
			}},
		{header:'${text("指标类别1")}', name:'quotaType', hidden:true
			},
		{header:'${text("序号")}', name:'sortNum', index:'a.sort_num', width:150, align:"center"},
		{header:'${text("目标内容")}', name:'quotaContent', index:'a.quota_content', width:250, align:"left"},
		{header:'${text("单位")}', name:'quotaUnit', index:'a.quota_unit', width:80, align:"left"},
		{header:'${text("权数")}', name:'quotaWeight', index:'a.quota_weight', width:100, align:"center",
			formatter: function(val, obj, row, act){
				if (val==''||typeof val=="undefined"){val=0;}
				return val.toFixed(2);
			}},
		{header:'${text("本年度目标")}', name:'currentYaerGoal', index:'a.current_yaer_goal', width:150, align:"left"},
		{header:'${text("考核方式")}', name:'assessMethod', width:150, align:"left", formatter: function(val, obj, row, act){
				return js.getDictLabel(${@DictUtils.getDictListJson('dc_exam_assessment')}, val, '${text("")}', true);
			}},
		{header:'${text("上一年度目标任务")}', name:'lastYaerGoal', index:'a.last_yaer_goal', width:150, align:"left"},
		{header:'${text("上一年度完成情况")}', name:'lastYearComplete', index:'a.last_year_complete', width:150, align:"left"},
		{header:'${text("备注")}', name:'remarks', index:'a.remarks', width:150, align:"center", formatter: function(val, obj, row, act){
				return js.getDictLabel(${@DictUtils.getDictListJson('dc_exam_remarks')}, val, '${text("未知")}', true);
			}},
		// {header:'${text("操作")}', name:'actions', width:150, formatter: function(val, obj, row, act){
		// 	var actions = [];
		//
		// 		actions.push('<a href="${ctx}/quota/dcSupExamQuotaInfo/form?id='+row.id+'" class="btn btn-primary btn-xs btnList" title="${text("修改")}" >修改</a>&nbsp;');
		// 		actions.push('<a href="${ctx}/quota/dcSupExamQuotaInfo/delete?id='+row.id+'" class="btn btn-danger btn-xs btnList" title="${text("删除")}" data-confirm="${text("确认要删除该指标吗？")}">删除</a>&nbsp;');
		// 	return actions.join('');
		// }},
		{header:'${text("操作2")}', name:'actions',hidden:true}
	],
	autoGridHeight: function(){return 'auto'},
	// 加载成功后执行事件
	showRownum: false,
	showFooter: true, // 是否显示底部合计行
	ajaxSuccess: function(data){
		refreshZpCount()
	}
});

//打开新的标签
function addQuotaInfo(QuotaId) {
	js.addTabPage(null, "新增指标","${ctx}/quota/dcSupExamQuotaInfo/form?quotaId="+QuotaId, true);
}
$("#btnSubmit").click(function(){
//示范一个公告层
	layer.open({
		type: 1
		,title: ['关键指标报送', 'font-size:18px; color:orange;'] //不显示标题栏
		,btn: ['确认', '取消']
		,btnAlign: 'c'
		,area: '300px;'
		,moveType: 1 //拖拽模式，0或者1
		,content: '<div style="padding: 50px">您确定报送XXXXXXXXXX指标吗</div>'
		,yes: function(layero){


					js.ajaxSubmitForm($('#inputForm'), function(data){
						js.showMessage(data.message);
						if(data.result == Global.TRUE){
							js.closeCurrentTabPage(function(contentWindow){
								contentWindow.page();
							});
						}
					}, "json");


		}
	});

})
function cz(){
	searchForm.reset();
	$('#dataGrid').dataGrid('reloadGrid');
}
</script>